using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace CodeStory.SmartUpload
{
	public class SmartUploadConfigurationSection : ConfigurationSection
	{
		[ConfigurationProperty("TempFilePath")]
		public string TempFilePath {
			get { return (string)this["TempFilePath"]; }
			set { this["TempFilePath"] = value; }
		}
		[ConfigurationProperty("AutoDeleteTempFiles")]
		[DefaultSettingValue("false")]
		public bool AutoDeleteTempFiles {
			get { return (bool)this["AutoDeleteTempFiles"];}
			set { this["AutoDeleteTempFiles"] = value; }
		}
	}
	public static class SmartConfiguration
	{
		static SmartUploadConfigurationSection section;
		static SmartConfiguration() {
			section = ConfigurationManager.GetSection("SmartUpload") as SmartUploadConfigurationSection;
			if (section == null) {
			}
		}
		public static string TempFilePath {
			get {
				if (section == null) {
					return SmartService.AssemblyGuidString;
				}
				return section.TempFilePath;
			}
		}
		public static bool AutoDeleteTempFiles {
			get {
				if (section == null) {
					return false;
				}
				return section.AutoDeleteTempFiles;
			}
		}
	}
}
